
package CCT220_Trabalho04_13106.view;


import javax.swing.JOptionPane;


/**
 * </br>******************************
 * </br>Project: CCT220
 * </br>Package: CCT220_Trabalho04_13106.view
 * </br>Class: LimitePrincipal
 * </br>Last Change: 08/10/2011 11:24:01 by marcel
 * </br>Description:Class the manage the limit between the entities and the
 * user
 * </br>******************************</br>
 * 
 * @author marcel
 * @author 13106
 * 
 */
public class LimitePrincipal {

	/**
	 * </br>******************************
	 * </br>Package: CCT220_Trabalho04_13106.view
	 * </br>Class: LimitePrincipal
	 * </br>Method: montaMenu
	 * </br>Last Change: 08/10/2011 11:24:02 by marcel
	 * </br>Description: Method that show the options to the user and return the
	 * chosen one
	 * </br>******************************</br>
	 * 
	 * @return the chosen option
	 */
	public int montaMenu() {

		int escolha = -1;
		String escolhaInformada = "";
		do {
			try {
				escolhaInformada = JOptionPane
				        .showInputDialog("Escolha uma opção do menu principal:\n"
				                + "[1] Manejar disciplina\n"
				                + "[2] Manejar estudante\n"
				                + "[3] Manejar turma\n"
				                + "[4] Manejar Assentamentos\n"
				                + "[5] Finaliza");
				escolha = Integer.parseInt(escolhaInformada);
			} catch (Exception exc) {
			}
		} while ((escolha < 1) || (escolha > 5));
		return escolha;
	}


	/**
	 * </br>******************************
	 * </br>Package: CCT220_Trabalho04_13106.view
	 * </br>Class: LimitePrincipal
	 * </br>Method: showErrorMessage
	 * </br>Last Change: 08/10/2011 11:24:04 by marcel
	 * </br>Description: Method that show the given String in a JOptionPane with
	 * error message icon
	 * </br>******************************</br>
	 * 
	 * @param string
	 */
	public void showErrorMessage(String string) {

		JOptionPane.showMessageDialog(null, string, "Erro",
		        JOptionPane.ERROR_MESSAGE);

	}

}
